<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--<link href="/css/bootstrap.min.css" rel="stylesheet">-->
<link href="/fonts/iconfont/iconfont.css" rel="stylesheet">
<link type="text/css" href="/css/cultivateWeb/style/course.css" rel="stylesheet">
<link type="text/css" href="/css/cultivateWeb/style/trainingResourcesDetails_directory.css" rel="stylesheet">

<link type="text/css" href="/lib/vide7.5.5/css/video-js.min.css" rel="stylesheet">
<link href="/css/bootstrap.min.css" rel="stylesheet">

<head th:include="cultivateWeb/header :: culHeaderCss"></head>

<style>
    .xianshi span {
        color: #fff
    }

    .title_1 {
        color: #333;
        font-size: 14px;
        font-weight: 700;
    }

    p {
        font-size: 14px
    }

    .video-js .vjs-tech {
        display: flex;
        flex-direction: row;
        justify-content: center;
    }
</style>

<body>
    <!-- 顶部导航 -->
    <header th:include="cultivateWeb/header :: header(true)"></header>

    <script type="text/javascript" src="/js/cultivateWeb/resourceJquery.js"></script>
    <script type="text/javascript" src="/js/cultivateWeb/trainingResourceDetaiksC.js"></script>
    <script type="text/javascript" src="/js/cultivateWeb/trainingResourceDetaiks.js"></script>

    <div id="layui-container2" style="background-color: #f7f7f7; ">
        <div class="layui-container">
            <p style="line-height: 40px">当前位置：<a href="/cultivate/homepage">首页</a> >
                <a href="/cultivate/courseIndex">培训课程</a> > 课程详情
            </p>
        </div>
        <div class="container">
            <div class="row">
                <section>
                    <div class="img_box">
                        <p><img th:src="${cou.thumbnail}" class="courimg" style="margin: 0" id="courseImg"></p>
                        <div class="div_1">
                            <input type="hidden" id="isMyCourse" />
                            <input type="hidden" id="courseId" th:value="${cou.id}" />
                            <input type="hidden" id="chapterId" th:value="${chapterId}" />
                            <span class="span_1" th:text="${cou.name}"></span>

                            <span class="span_2" th:if="${cou.specialPrice=='0.00'}">
                                <span style="color:#fe7252;font-size:22px">免费</span>
                            </span>
                            <span class="span_2">课程类型：
                                <span th:if="${cou.type==0}">证书课程</span>
                                <span th:if="${cou.type==1}">师资培训课程</span>
                                <span th:if="${cou.type==2}">考评员培训课程</span>
                                <span th:if="${cou.type==3}">高级师资培训课程</span>
                                <span th:if="${cou.type==4}">高级考评员培训课程</span>
                                 <span th:if="${cou.type==5}">金职大讲堂</span>
                            </span>
                            <span class="span_2">讲师名：<span th:text="${cou.teacherName}"></span></span>
                        </div>
                        <div style="clear: both"></div>
                    </div>
                    <div class="div_2">
                        <div class="fieldset-list ">
                            <div class="title-top" style="position: relative">
                                <h2 th:text="${chapterInfo.name}"
                                    style="height: 50px;display: flex;flex-direction: row;align-items: center;"></h2>
                                <a th:href="'/couInfo/couInfo?id='+${cou.id}"
                                    style="position: absolute; right: 5px; top: 7px; color: #A6A6A6;">&lt;返回课程内容</a>
                            </div>
                            <div class="Qin_micro_lesson">
                                <div class="Qin_exam">
                                    <div class="Qin_exam_title clefix" id="Qin_exam_lesson">
                                        <div class="course-arrow left">
                                            <i class="iconfont icon-icon_on_the_left" aria-hidden="true"
                                                style="margin-right: 0px;color: #666666;font-size: 35px;"></i>
                                        </div>
                                        <div class="course-arrow right">
                                            <i class="iconfont icon-icon_on_the_right" aria-hidden="true"
                                                style="margin-right: 0px;color: #666666;font-size: 35px;"></i>
                                        </div>
                                        <div class="course-center">
                                            <div id="resourcesListDiv" class="clefix resource"
                                                style="margin-left: 0px;display: flex;flex-direction: row;align-items: center;">
                                                <INPUT id="initResourcesType" TYPE="hidden" th:value="${initResourcesType}" />
                                                <INPUT id="initPaperId" TYPE="hidden" th:value="${initPaperId}" />
                                                <INPUT id="rsize" TYPE="hidden" th:value="${rsize}" />
                                                <INPUT id="rindexCurrent" TYPE="hidden" th:value="${rindexCurrent}" />
                                                <INPUT id="lastRindex" TYPE="hidden" th:value="${rindexCurrent}" />
                                                <INPUT id="rTypeCurrent" TYPE="hidden" th:value="${rTypeCurrent}" />
                                                <INPUT id="rIdCurrent" TYPE="hidden" th:value="${rIdCurrent}" />
                                                <th:block th:each="res,loopStatus : ${resources}">
                                                    <!-- <a th:id="'index_'+{res.rindex}" th:href="'/couInfo/couInfo/trainingResourcesDetails?id='+${chapterInfo.id}+'&resourceId='+${res.id}+'&rindex='+${res.rindex}" th:class="${res.rindex+''==rindexCurrent+''?'seled':''}" style="text-align: center;">-->
                                                    <!--th:style="${res.rindex+''==rindexCurrent+''?'background-color: #009999;':''}"-->
                                                    <a th:id="${'index_' + res.rindex}" href="javascript:void(0)"
                                                        th:onclick="|changeIndex('${chapterInfo.id}', '${res.rindex}', '${res.id}')|"
                                                        style="text-align: center;">
                                                        <th:block th:if="${res.type}==0">
                                                            <i class="iconfont icon-wendang" aria-hidden="true"
                                                                style="margin-right: 0px;color: #d6204b;font-size: 35px;"></i>
                                                        </th:block>
                                                        <th:block th:if="${res.type}==1">
                                                            <i class="iconfont icon-icon-test" aria-hidden="true"
                                                                style="margin-right: 0px;color: #f68859;font-size: 35px;"></i>
                                                        </th:block>
                                                        <th:block th:if="${res.type}==2">
                                                            <i class="iconfont icon-ppt" aria-hidden="true"
                                                                style="margin-right: 0px;color: #f68859; font-size: 35px;"></i>
                                                        </th:block>
                                                        <th:block th:if="${res.type}==3">
                                                            <i class="layui-icon layui-icon-file" aria-hidden="true"
                                                                style="margin-right: 0px"></i>
                                                        </th:block>
                                                        <th:block th:if="${res.type}==4">
                                                            <i class="iconfont icon-icon-test1" aria-hidden="true"
                                                                style="margin-right: 0px;color: #f68859;font-size: 35px;"></i>
                                                        </th:block>
                                                        <th:block th:if="${res.type}==5">
                                                            <i class="iconfont icon-icon-test" aria-hidden="true"
                                                                style="margin-right: 30px;color: #f68859;font-size: 35px;"></i>
                                                        </th:block>
                                                    </a>
                                                </th:block>
                                                <th:block th:each="res,loopStatus : ${paperList}">
                                                    <a th:id="${''+res.paper_id}" href="javascript:void(0)"
                                                       th:onclick="|toLookTask('${res.paper_id}', '')|"
                                                       style="text-align: center;">
                                                        <i class="iconfont icon-xiti" aria-hidden="true"
                                                               style="margin-right: 0px;color: #d6204b;font-size: 35px;"></i>
                                                    </a>
                                                </th:block>
                                            </div>
                                        </div>
                                    </div>
                                    <!--<div id="taskDiv">
                                        <div class="taskDivItem" style="margin: 0px;">

                                        </div>
                                    </div>-->
                                    <!--滚动视图-->
                                    <div id="scrollView">
                                        <!--滚动内容-->
                                        <div id="scrollContent">

                                        </div>
                                        <!--滚动条区域-->
                                        <div id="scrollTrack">
                                            <!--小幅度向上滚动按钮-->
                                            <div id="btnUp">
                                                <i class="iconfont icon-icon_on_the_top" aria-hidden="true"
                                                   style="margin-right: 0px;color: #000000;font-size: 20px;"></i>
                                            </div>
                                            <!--大幅度向上滚动点击区域-->
                                            <div id="trackUp" style="background-color: #ffffee;"></div>
                                            <!--滚动条滑块-->
                                            <div id="scrollBar"></div>
                                            <!--大幅度向下滚动点击区域-->
                                            <div id="trackDown" style="background-color: #ffffee;"></div>
                                            <!--小幅度向下滚动按钮-->
                                            <div id="btnDown">
                                                <i class="iconfont icon-icon_on_the_down" aria-hidden="true"
                                                   style="margin-right: 0px;color: #000000;font-size: 20px;"></i>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="Qin_exam_lesson_con">
                                        <div class="view_text_con" style="margin: 0px;">

                                        </div>
                                    </div>
                                    <div class="xianshi" style="font-size: 20px;margin-bottom: 10px;width: 100%;">
                                    </div>
                                    <div id="intro" style="width: 100%;padding: 0 10px;box-sizing: border-box;"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </div>

    <div id="createCode" style="display: none">
        <div style="margin-top: 40px;text-align:center">
            <input placeholder="请输入验证码" id="code" /><span class="getSmsCodeBtn"></span> <span class='right'
                style="cursor: pointer" onclick='createCode()'>换一张</span>
        </div>
    </div>


    <script id="doc_html" type="text/html">
    <style>
        .Preview {
            width: 197px;
            height: 245px;
            margin: 110px auto;
        }

        .Preview p {
            text-align: center;
            color: #6d6d6d;
        }

        .Preview p span {
            font-size: 20px;
            vertical-align: sub;
            margin-right: 15px;
        }

        /*.Preview p a {
            display: inline-block;
            width: 71px;
            height: 24px;
            background: url('/study/css/img/xiazai.png') no-repeat;
        }*/

        a:hover {
            text-decoration: none;
        }

        a, a.f-fcgreen {
            color: #009999;
        }
    </style>
    {{if extension!='other'}}
    <div class="docBox" data-url="{{newUrl}}" data-downloadurl="{{fileRoute}}" data-id="{{id}}" style="height: 600px; position: relative;">

        {{if fileRoute==''}}
        <div class="Preview">
            <p>
                <span>当前文件无法预览,文件不存在</span>
            </p>
        </div>
        {{/if}}

    </div>
    {{/if}}
    {{if extension=='other'}}
        <div class="Preview" style="width: 100%;text-align: center">
            <p>
                <span>当前文件无法预览</span>
                {{if downloadFlag == 1}}
                <a href="{{fileRoute}}" target="_self" class="downloadDoc" style="font-size: 14px;  right: 46px; bottom: 0px; text-decoration: underline; color: #228da8;">下载该资源</a>
                {{/if}}
                {{if downloadFlag == 0}}
                <a href="javacript:void(0);" target="_self" class="downloadDoc" style="font-size: 14px;  right: 46px; bottom: 0px; text-decoration: underline; color: #999;">该资源不能下载</a>
                {{/if}}
            </p>
        </div>
    {{/if}}
    {{if fileRoute!=''}}
    {{if downloadFlag == 1}}
    <a href="{{fileRoute}}" target="_self" class="downloadDoc" style="font-size: 14px;  right: 46px; bottom: 0px; text-decoration: underline; color: #228da8;">下载该资源</a>
    {{/if}}
    {{if downloadFlag == 0}}
    <a href="javacript:void(0);" target="_self" class="downloadDoc" style="font-size: 14px;  right: 46px; bottom: 0px; text-decoration: underline; color: #999;">该资源不能下载</a>
    {{/if}}
    {{/if}}
    </script>

    <script id="task_html" type="text/html">
        <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">
            <div class="list dis_row a_center" style="width: 100%;height: 100%;">
                <h3 style="margin-left: 10px;color: #666;line-height: 20px;">1.&nbsp;&nbsp;晓&nbsp;<span style="color:green;">分值（10分）</span>
                    <span style="color:red;">得分（5 分）</span>
                </h3>
            </div>
        </div>
        <!--<div id="scrollView">
            &lt;!&ndash;滚动内容&ndash;&gt;
            <div id="scrollContent">

            </div>
            &lt;!&ndash;滚动条区域&ndash;&gt;
            <div id="scrollTrack">
                &lt;!&ndash;小幅度向上滚动按钮&ndash;&gt;
                <div id="btnUp"></div>
                &lt;!&ndash;大幅度向上滚动点击区域&ndash;&gt;
                <div id="trackUp"></div>
                &lt;!&ndash;滚动条滑块&ndash;&gt;
                <div id="scrollBar"></div>
                &lt;!&ndash;大幅度向下滚动点击区域&ndash;&gt;
                <div id="trackDown"></div>
                &lt;!&ndash;小幅度向下滚动按钮&ndash;&gt;
                <div id="btnDown"></div>
            </div>
        </div>-->

    </script>

    <style>
        .dis_row{
            display: flex;flex-direction: row;
        }
        .dis_column{
            display: flex;flex-direction: column;
        }
        .a_center{
            align-items: center;
        }
        .j_center{
            justify-content: center;
        }
        .discuss_top{
            background: #ffffff;margin-top: 0px;width: 100%;font-size: 16px;color: #999;
            border-bottom: 1px solid #dfdfdf;
            /* height: 150px;*/
            height: 80px;
        }
        .discuss_top_title{
            margin-top: 0px;width: 100%;color: #999;
            height: 80px;
        }
        .discuss_top_content{
            margin-top: 0px;width: 100%;color: #666;
            height: auto;
        }
        .discuss_list{
            background: #ffffff;margin-top: 0px;width: 100%;font-size: 16px;color: #999;
        }
        .discuss_buttons{
            margin-top: 0px;width: 100%;font-size: 16px;
            height: 200px;background-color: #f5f5f5;
        }
        .discuss_buttons_textarea{
            width: 85%;
            border: 1px solid #ccc;
            border-radius: 4px;
            color: #555;
            background: #ffffff;
            padding: 4px 4px;
        }
        .discuss_buttons_send{
            width: 100px;
            height: 35px;
            border-radius: 10px;
            background-color: #22ac38;
            color: #ffffff;
            text-align: center;

        }
        #scrollView {
            width: 100%;
            height: 600px;
            /*上下边距是为了演示当滚动到顶部或底部时，继续滚动鼠标滚轮会滚动整个页面*/
            margin: 100px 0;
            display: flex;
        }

        #scrollContent {
            width: 100%;
            height: 100%;
            padding-left: 8px;
            /*background-color: antiquewhite;*/
            /*隐藏超出滚动内容区域的元素*/
            overflow: hidden;
        }

        #scrollTrack {
            width: 20px;
            height: 100%;
            background-color: #A6A6A6;
            display: flex;
            /*竖着排列滚动条区域内的上下按钮、滑块等元素*/
            flex-direction: column;
        }

        #btnUp, #btnDown {
            height: 20px;
            background-color: #f5f5f5;
        }

        #scrollBar {
            height: 50px;
            background-color: #A6A6A6;
        }

        #trackDown {
            /*让大幅度向下滚动点击区域占据排列完其他元素后剩下的所有区域*/
            flex-grow: 1;
            background-color: #ffffff;
        }

        /*当拖动滑块时，给body元素加上该类，防止鼠标的拖动导致网页内容的选择操作*/
        .unselectable {
            /*当前版本的火狐（53）和Edge（15）不支持user-select标准属性，需要使用浏览器厂商前缀*/
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
        element.style {
            background-color: #f6f6f6;
        }
    </style>

    <script>
        //（若想要加载多个组件，如：时间，表单可用[])
        layui.use(['layer'],function(){
            var layer = layui.layer;  //layer初始化
        })
        var scrollContent = document.getElementById("scrollContent");

        //给滚动内容区域填充大量元素
        for (var i = 1; i <= 300; i++) {
            var row = document.createElement("div");
            row.innerText = " ~";
            row.style.color = "#ffffff";
            scrollContent.appendChild(row);
        }

        //指示鼠标左键是否处于按下状态的变量，在滑块上按下鼠标左键时设为true，在页面上任意位置松开时设回false
        //由于鼠标拖动滑块时可能会离开滑块，所以mouseup和mousemove事件是注册在window上的
        //在mousemove事件处理程序中，会检查该变量，以确定当前是否在拖动滑块
        var mouseHeld = false;
        //记录上一次mousemove事件发生时，鼠标的Y轴位置，每次发生mousemove事件时，跟上一次作比较，确定需要滚动多少距离
        var previousClientY = 0;
        //滑块可滑动的距离，计算方式为整个滚动条高度度减去上下按钮的高度，再减去滑块本身的高度
        var barMoveLength = 600 - 20 * 2 - 50;
        //内容区域可滚动的距离，计算方式为内容区域的总高度减去内容区域本身的高度
        var contentMoveLength = scrollContent.scrollHeight - 600;

        //为上下按钮注册事件处理程序
        document.getElementById("btnUp").addEventListener("click", function () {
            scrollToRelative(-30);
        });
        document.getElementById("btnDown").addEventListener("click", function () {
            scrollToRelative(30);
        });

        //为大幅度上下滚动点击区域注册事件处理程序
        //保存trackUp元素变量，因为每次滚动时，都要改变它的高度，以达到移动滑块的效果
        var trackUp = document.getElementById("trackUp");
        trackUp.addEventListener("click", function () {
            scrollToRelative(-600);
        });
        document.getElementById("trackDown").addEventListener("click", function () {
            scrollToRelative(600);
        });

        //为滑块注册鼠标按下事件处理程序，因为只有在滑块上按下鼠标左键时，才算开始拖动滑块
        document.getElementById("scrollBar").addEventListener("mousedown", function (e) {
            mouseHeld = true;
            previousClientY = e.clientY;
            //防止页面因为鼠标的拖动而选择上了文本或其他元素
            document.body.classList.add("unselectable");
        });

        //鼠标左键松开时可能不在滑块上，所以mouseup事件注册在document上
        document.addEventListener("mouseup", function (e) {
            mouseHeld = false;
            //让页面恢复可选择
            document.body.classList.remove("unselectable");
        });

        //鼠标拖动时可能离开滑块，所以mousemove事件也注册在document上
        document.addEventListener("mousemove", function (e) {
            if (mouseHeld) {
                //相对滑动距离计算依据为滑块滑动距离占总可滑动距离的比应与内容滚动距离占总可滚动距离的比相等
                scrollToRelative((e.clientY - previousClientY) * contentMoveLength / barMoveLength);
                previousClientY = e.clientY;
            }
        });

        //为内容区域注册鼠标滚轮事件处理程序
        //火狐浏览器使用和其他浏览器不同的滚轮事件和事件参数属性
        if (navigator.userAgent.indexOf("Firefox") < 0) {
            scrollContent.addEventListener("mousewheel", function (e) {
                handleMouseWheel(-e.wheelDelta, e);
            });
        } else {
            scrollContent.addEventListener("DOMMouseScroll", function (e) {
                handleMouseWheel(e.detail * 30, e);
            });
        }

        //确定内容区域当前是否在顶部或底部
        function isOnTopOrBottom() {
            //判断是否在底部时，用了向上取整函数，因为在chrome下，滚动到底时，scrollTop常为小数，与contentMoveLength不等，向上取整之后一般相等
            return scrollContent.scrollTop == 0 || Math.ceil(scrollContent.scrollTop) == contentMoveLength;
        }

        //鼠标滚轮事件的处理程序，relative为相对滚动距离，e为事件参数
        function handleMouseWheel(relative, e) {
            //记录下滚动之前内容区域是否在两端
            var previousOnTopOrBottom = isOnTopOrBottom();
            scrollToRelative(relative);
            //如果现在不在两端，或者现在在两端而滚动之前不在，则屏蔽默认滚轮行为————滚动整个页面
            //反过来说，只有当“滚动”（实际上内容区域未滚动）前后内容区域都在某一端时，即已经到两端之后继续滚动时，才让滚动整个页面
            if (!isOnTopOrBottom() || (isOnTopOrBottom() && !previousOnTopOrBottom)) {
                e.preventDefault();
            }
        }

        //将内容区域滚动到某一绝对位置
        function scrollTo(top) {
            if (top < 0) {
                scrollContent.scrollTop = 0;
            } else if (top > contentMoveLength) {
                scrollContent.scrollTop = contentMoveLength;
            } else {
                scrollContent.scrollTop = top;
            }

            //设置滑块的位置，这是通过设置滑块上面的大幅度向上滚动点击区域的高度实现的
            //滑块位置计算依据为滑块距顶部距离占总可滑动距离的比应与内容区域距顶部距离占总可滚动距离的比相等
            var barDownDistance = scrollContent.scrollTop * barMoveLength / contentMoveLength;
            trackUp.style.height = barDownDistance + "px";
        }

        //将内容区域滚动某一相对距离
        function scrollToRelative(relative) {
            scrollTo(scrollContent.scrollTop + relative);
        }
    </script>


    <!-- footer ------------------------------------------------------- -->
    <div class="footer" th:include="cultivateWeb/header :: footer"></div>
</body>

<script type="text/javascript" src="/js/xlPaging.js"></script>
<!--<script type="text/javascript" src="/js/bootstrap.min.js"></script>-->
<script src="/js/jquery.min.js"></script>
<script src="/lib/vide7.5.5/js/video.min.js"></script>
<script>
    $(function () {
        $('#scrollView').hide();
        getData();

        //toGetResourcesList();//添加作业

        var initResourcesType = $("#initResourcesType").val();
        if(initResourcesType=='paper'){
            var initPaperId = $("#initPaperId").val();
            toLookTask(initPaperId,'init');
        }
    });

    function toGetResourcesList(){
        var courseId = $('#courseId').val();
        var chapterIds = $('#chapterId').val();

        var flag = true;
        if(chapterIds=='' || chapterIds==undefined || chapterIds=='undefined'){
            flag = false;
            layer.alert("参数错误！");
        }
        if(flag){
            ajaxToken("/jzApi/courses/getResourcesList", 'POST',
                {
                    chapterIds: chapterIds,
                    courseId: courseId
                }, function (res) {
                    console.log("res:"+res);
                    console.log("res:"+JSON.stringify(res));
                    if(res.length>0){
                        for(var a=0; a<res.length; a++){
                            var str = '';
                            var cssStr = '';
                            var initPaperId = $("#initPaperId").val();
                            if(initPaperId+'' == res[a].paper_id +''){
                                cssStr = 'class="seled"';
                            }
                            var contentStr='<a id="'+ res[a].paper_id +'" href="javascript:void(0)"' + cssStr +
                                '           onclick="toLookTask('+ res[a].paper_id +','+str+')"' +
                                '           style="text-align: center;">' +
                                '               <i class="iconfont icon-xiti" aria-hidden="true"\n' +
                                '                style="margin-right: 0px;color: #d6204b;font-size: 35px;"></i>' +
                                '           </a>';

                            $('#resourcesListDiv').append(contentStr);
                        }

                    }
                }
            )
        }


    }


    function toLookTask(id,type) {
        console.log("id:"+id+"\ntype:"+type);
        if(type == 'init'){
            var initPaperId = $("#initPaperId").val();
            console.log("initPaperId:"+initPaperId);
            $(".Qin_exam_title a").removeClass("seled");
            //$(".Qin_exam_title a").css("background-color", "");
            //var obj = document.getElementById(initPaperId);
            //obj.style.backgroundColor= "black";
            //obj.style.cssText = "background: #46AFBC;";
            $('#'+initPaperId).addClass("seled");
        }else {
            $(".Qin_exam_title a").removeClass("seled");
            //$(".Qin_exam_title a").css("background-color", "");
            /*var obj = document.getElementById(id);
            obj.style.cssText = "background: #46AFBC;";*/
            $('#'+id).addClass("seled");
        }

        $('.view_text_con').html("");
        $(".xianshi").html("");
        $("#intro").html("");
        ajaxToken("/jzApi/courses/selTaskInfo", 'POST',
            {
                id: id
            },function (res) {
                //console.log("res:"+res);
                //console.log("res:"+JSON.stringify(res));
                if (res.data == 0) {
                    $("#scrollContent").html('<div class="noData">暂无数据</div>');
                } else {
                    let disableStr = '';
                    let showGetScore = false;
                    let data = res;
                    items = res;
                    let detailsStr = '<div class="list">\n' +
                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #edfdff;height: 50px;">\n' +
                        '        <div class="list dis_row a_center" style="background-color: #fff;width: 33%;height: 100%;">\n' +
                        '            <h2 style="margin-left: 10px;color: #999;">作业</h2>\n' +
                        '        </div>\n' +
                        '        <div class="list dis_row a_center" style="background-color: #fff;width: 51%;height: 100%;justify-content: flex-end;">\n';
                    //console.log("items.isOver:"+items.isOver);
                    if(items.isOver == 0 && (items.submitId == '' || (items.submitId != '' && items.submitStatus == 0))){
                        detailsStr+='<div onclick="stubmitTasksAswer(0)" class="discuss_buttons_send dis_row a_center j_center ">\n' +
                            '                暂存作业\n' +
                            '             </div>\n' ;
                        detailsStr+='<div onclick="stubmitTasksAswer(1)" class="discuss_buttons_send dis_row a_center j_center " style="margin-left: 20px;">\n' +
                            '                提交作业\n' +
                            '            </div>\n';
                    }else {
                        disableStr = ' disabled="disabled"';
                        showGetScore = true;
                    }


                    detailsStr+='</div>\n' +
                        '        <div class="list dis_row a_center" style="background-color: #ffffff;width: 15%;height: 100%;justify-content: flex-end;">\n' +
                        /*'            <h2 onclick="returnTaskList()" style="margin-left: 10px;color: #999;">\n' +
                        '                返回\n' +
                        '            </h2>\n' +*/
                        '        </div>\n' +
                        '    </div>\n';
                    let number = 0;
                    if(data.itmsType0Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">单选题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType0Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';
                        data.itmsType0.forEach(function (item, index) {
                            number+=1;
                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;'+item.topic_content+' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                            if(showGetScore) {
                                detailsStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                            }
                            detailsStr +='  </h3>\n' +
                                '        </div>\n' +
                                '    </div>\n';
                            if(item.children.length>0){
                                item.children.forEach(function (item2, index2) {
                                    detailsStr +=
                                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                        '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                                    if(item2.selected==1){
                                        detailsStr +=
                                            '            <input style="margin-left: 40px;" type="radio" '+ disableStr +' onchange="changeValue(\'itmsType0\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType0_'+index+'\')" name="itmsType0_'+index+'" value="'+item2.value+'" checked="checked"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }else  if(item2.selected==0){
                                        detailsStr +=
                                            '        <input style="margin-left: 40px;" type="radio" '+ disableStr +'  onchange="changeValue(\'itmsType0\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType0_'+index+'\')" name="itmsType0_'+index+'" value="'+item2.value+'"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }
                                    detailsStr +=
                                        '        </div>\n' +
                                        '    </div>\n';
                                });
                            }
                        });
                    }
                    if(data.itmsType1Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">多选题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType1Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';
                        data.itmsType1.forEach(function (item, index) {
                            number+=1;
                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;'+item.topic_content+' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                            if(showGetScore) {
                                detailsStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                            }
                            detailsStr +='</h3>\n' +
                                '        </div>\n' +
                                '    </div>\n';
                            if(item.children.length>0){
                                item.children.forEach(function (item2, index2) {
                                    detailsStr +=
                                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                        '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                                    if(item2.selected==1){
                                        detailsStr +=
                                            '            <input style="margin-left: 40px;" type="checkbox" '+ disableStr +'  onchange="changeValue(\'itmsType1\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType1_'+index+'\')" name="itmsType1_'+index+'" value="'+item2.value+'" checked="checked"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }else  if(item2.selected==0){
                                        detailsStr +=
                                            '        <input style="margin-left: 40px;" type="checkbox" '+ disableStr +'  onchange="changeValue(\'itmsType1\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType1_'+index+'\')" name="itmsType1_'+index+'" value="'+item2.value+'"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }
                                    detailsStr +=
                                        '        </div>\n' +
                                        '    </div>\n';
                                });
                            }
                        });
                    }
                    if(data.itmsType2Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">判断题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType2Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';
                        data.itmsType2.forEach(function (item, index) {
                            number+=1;
                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;'+item.topic_content+' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                            if(showGetScore) {
                                detailsStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                            }
                            detailsStr +='</h3>\n' +
                                '        </div>\n' +
                                '    </div>\n';
                            if(item.children.length>0){
                                item.children.forEach(function (item2, index2) {
                                    detailsStr +=
                                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                        '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                                    if(item2.selected==1){
                                        detailsStr +=
                                            '            <input style="margin-left: 40px;" type="radio" '+ disableStr +'  onchange="changeValue(\'itmsType2\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType2_'+index+'\')" name="itmsType2_'+index+'" value="'+item2.value+'" checked="checked"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }else  if(item2.selected==0){
                                        detailsStr +=
                                            '        <input style="margin-left: 40px;" type="radio" '+ disableStr +'  onchange="changeValue(\'itmsType2\',\''+item2.value+'\','+index+ ',' + index2 + ',\'itmsType2_'+index+'\')" name="itmsType2_'+index+'" value="'+item2.value+'"/><label style="margin-left: 20px;">'+item2.value+'</label>';
                                    }
                                    detailsStr +=
                                        '        </div>\n' +
                                        '    </div>\n';
                                });
                            }
                        });
                    }
                    if(data.itmsType3Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">填空题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType3Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';

                        data.itmsType3.forEach(function (item, index) {
                            number+=1;
                            if(item.children.length>0){
                                let titleStr = '';
                                let childrenStr = '';
                                detailsStr +=
                                    '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                    '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                    '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;\n';
                                item.children.forEach(function (item2, index2) {

                                    titleStr += '<span style="margin-left: 10px;color: #666;">' ;
                                    if(index2 < item.children.length-1){
                                        titleStr += item2.topic+'</span>' +
                                            '<span style="background-color: #e8f9ff;margin-left: 10px;color: #666;">(填空'+(index2+1)+')</span>';
                                    }else {
                                        titleStr += item2.topic+'</span>';
                                    }

                                    if(index2 < item.children.length-1) {
                                        childrenStr +=
                                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                            '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                                        // childrenStr +=
                                        //      '          <input style="margin-left: 40px;width: 80%;height: 50px;" type="text" onblur="changeValue(\'itmsType3\',\'\',' + index + ',\'itmsType3_' + index + '_'+ index2 +'\')" name="itmsType3_' + index+ '_'+ index2 +'\'" id="itmsType3_' + index + '_'+ index2 +'\'" value="' + item2.value + '"/>';
                                        childrenStr +=
                                            '          <input style="margin-left: 40px;width: 80%;height: 50px;" type="text" '+ disableStr +'  placeholder="请输入填空' + (index2+1) + '的答案"  onblur="changeValue(\'itmsType3\',this.value,' + index + ',' + index2 + ',\'itmsType3_' + index + '\')" name="itmsType3_' + index+ '_'+ index2 +'\'" id="itmsType3_' + index + '_'+ index2 +'\'" value="' + item2.value + '"/>';

                                        childrenStr +=
                                            '        </div>\n' +
                                            '    </div>\n';
                                    }
                                });
                                titleStr += ' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                                if(showGetScore) {
                                    titleStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                                }
                                titleStr +='</h3>';
                                detailsStr += titleStr;
                                detailsStr +='</div>\n' +
                                    '    </div>\n';
                                detailsStr += childrenStr;

                            }
                        });
                    }
                    if(data.itmsType4Num>0){
                        detailsStr +=
                            '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                            '        <div class="list dis_row a_center" style="background-color: #f7f7f7;width: 100%;height: 100%;">\n' +
                            '            <h2 style="margin-left: 10px;color: #000;">问答题</h2>\n' +
                            '            <span style="font-size: 14px;color: #999;margin-left: 10px;">共</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">'+data.itmsType4Num+'</span>\n' +
                            '            <span style="font-size: 14px;color: #999;">题</span>\n' +
                            '        </div>\n' +
                            '    </div>\n';
                        data.itmsType4.forEach(function (item, index) {
                            number+=1;
                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                                '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">'+ number +'.&nbsp;&nbsp;'+item.topic_content+' &nbsp;<span style="color:green;">分值（'+item.score+'分）</span>';
                            if(showGetScore) {
                                detailsStr +='<span style="color:red;">得分（' + item.getScore + '分）</span>';
                            }
                            detailsStr +='</h3>\n' +
                                '        </div>\n' +
                                '    </div>\n';

                            detailsStr +=
                                '    <div class="list dis_row a_center" style="border: 1px solid #edfdff;height: 100px;margin-top: 20px;">\n' +
                                '        <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n';
                            detailsStr +=
                                '            <textarea style="margin-left: 40px;height: 100px;width: 80%;border: 1px solid #999;"  '+ disableStr +'  placeholder="请输入答案" onblur="changeValue(\'itmsType4\',this.value,'+index+ ',\'\',\'itmsType4_'+index+'\')" name="itmsType4_'+index+'">'+item.answer+'</textarea>';

                            detailsStr +=
                                '        </div>\n' +
                                '    </div>\n';
                        });
                    }
                    detailsStr +=
                        '    <div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                        '        <div class="list dis_row a_center j_center" style="width: 100%;height: 100%;">\n' +
                        '            <h3 style="margin-left: 10px;color: #666;line-height: 20px;">已到底~';

                    detailsStr +='  </h3>\n' +
                        '        </div>\n' +
                        '    </div>\n';
                    detailsStr += '</div>';

                    /*var scrollDiv = '<div class="list dis_row a_center" style="border-bottom: 1px solid #f7f7f7;height: 50px;margin-top: 20px;">\n' +
                        '            <div class="list dis_row a_center" style="width: 100%;height: 100%;">\n' +
                        '                <h3 style="margin-left: 10px;color: #666;line-height: 20px;">1.&nbsp;&nbsp;晓&nbsp;<span style="color:green;">分值（10分）</span>\n' +
                        '                    <span style="color:red;">得分（5 分）</span>\n' +
                        '                </h3>\n' +
                        '            </div>\n' +
                        '        </div>\n' +
                        '        <div id="scrollView">\n' +
                        '            <!--滚动内容-->\n' +
                        '            <div id="scrollContent">'
                        + detailsStr +
                        '</div>\n' +
                        '            <!--滚动条区域-->\n' +
                        '            <div id="scrollTrack">\n' +
                        '                <!--小幅度向上滚动按钮-->\n' +
                        '                <div id="btnUp"></div>\n' +
                        '                <!--大幅度向上滚动点击区域-->\n' +
                        '                <div id="trackUp"></div>\n' +
                        '                <!--滚动条滑块-->\n' +
                        '                <div id="scrollBar"></div>\n' +
                        '                <!--大幅度向下滚动点击区域-->\n' +
                        '                <div id="trackDown"></div>\n' +
                        '                <!--小幅度向下滚动按钮-->\n' +
                        '                <div id="btnDown"></div>\n' +
                        '            </div>\n' +
                        '        </div>'*/;
                    $("#scrollContent").html(detailsStr);
                    $('#scrollView').show();
                }
            }
        )
    }
    function changeValue(type,value,index,index2,name) {
        if(type == 'itmsType0'){
            items.itmsType0[index].answer = value;
        }else if(type == 'itmsType1'){
            var obj = document.getElementsByName(name);
            let newValue='';
            for (var i = 0; i < obj.length; i++) {
                if (obj[i].checked) {
                    newValue += obj[i].value+";;";
                }
            }
            items.itmsType1[index].answer = newValue;
        }else if(type == 'itmsType2') {
            items.itmsType2[index].answer = value;
        }else if(type == 'itmsType3') {
            items.itmsType3[index].children[index2].value = value;
            let size = items.itmsType3[index].childrenSize;
            let newValue='';
            if(size>0){
                for (var i = 0; i < size; i++) {
                    if(i<size-1){
                        let cValue = items.itmsType3[index].children[i].value;
                        newValue += cValue+";;";
                    }
                }
            }
            items.itmsType3[index].answer = newValue;
        }else if(type == 'itmsType4') {
            items.itmsType4[index].answer = value;
        }
        //console.log(JSON.stringify(items));
    }

    function stubmitTasksAswer(type) {
        var index = layer.load(1, {
            shade: [0.1,'#fff'] ,//0.1透明度的白色背景
            content:'请稍候，正在提交作业...',
            success: function (layerContentStyle) {
                layerContentStyle.find('.layui-layer-content').css({
                    'padding-top': '35px',
                    'text-align': 'left',
                    'width': '300px'
                });
            }
        });
        //console.log("type:"+type);
        let submitData = {
            "submitType": type,
            "papersDeploymentId": items.id,
            "submitId": items.submitId,
            "itmsAnswer": '',
        }
        let array = [];
        if(items.itmsType0Num>0){
            for(let a = 0;a < items.itmsType0.length; a++){
                let obj ={
                    "id": items.itmsType0[a].id,
                    "answer": items.itmsType0[a].answer
                }
                array.push(obj);
            }
        }
        if(items.itmsType1Num>0){
            for(let a = 0;a < items.itmsType1.length; a++){
                let obj ={
                    "id": items.itmsType1[a].id,
                    "answer": items.itmsType1[a].answer
                }
                array.push(obj);
            }
        }
        if(items.itmsType2Num>0){
            for(let a = 0;a < items.itmsType2.length; a++){
                let obj ={
                    "id": items.itmsType2[a].id,
                    "answer": items.itmsType2[a].answer
                }
                array.push(obj);
            }
        }
        if(items.itmsType3Num>0){
            for(let a = 0;a < items.itmsType3.length; a++){
                let obj ={
                    "id": items.itmsType3[a].id,
                    "answer": items.itmsType3[a].answer
                }
                array.push(obj);
            }
        }
        if(items.itmsType4Num>0){
            for(let a = 0;a < items.itmsType4.length; a++){
                let obj ={
                    "id": items.itmsType4[a].id,
                    "answer": items.itmsType4[a].answer
                }
                array.push(obj);
            }
        }
        submitData.itmsAnswer = JSON.stringify(array);
        //console.log("submitData:"+JSON.stringify(submitData));

        ajaxToken("/jzApi/courses/submitTasksAnswer", 'POST',
            submitData,
            function (res) {
                layer.close(index);
                //console.log("res:"+res);
                //console.log("res:"+JSON.stringify(res));
                if (res == 1) {
                    //this.returnTaskList();
                    layer.msg("作业已提交！");
                }else {
                    layer.msg(res);
                }
            }
        )
    }


    //设置中文
    videojs.addLanguage('zh-CN', {
        "Play": "播放",
        "Pause": "暂停",
        "Current Time": "当前时间",
        "Duration": "时长",
        "Remaining Time": "剩余时间",
        "Stream Type": "媒体流类型",
        "LIVE": "直播",
        "Loaded": "加载完毕",
        "Progress": "进度",
        "Fullscreen": "全屏",
        "Non-Fullscreen": "退出全屏",
        "Mute": "静音",
        "Unmute": "取消静音",
        "Playback Rate": "播放速度",
        "Subtitles": "字幕",
        "subtitles off": "关闭字幕",
        "Captions": "内嵌字幕",
        "captions off": "关闭内嵌字幕",
        "Chapters": "节目段落",
        "Close Modal Dialog": "关闭弹窗",
        "Descriptions": "描述",
        "descriptions off": "关闭描述",
        "Audio Track": "音轨",
        "You aborted the media playback": "视频播放被终止",
        "A network error caused the media download to fail part-way.": "网络错误导致视频下载中途失败。",
        "The media could not be loaded, either because the server or network failed or because the format is not supported.": "视频因格式不支持或者服务器或网络的问题无法加载。",
        "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.": "由于视频文件损坏或是该视频使用了你的浏览器不支持的功能，播放终止。",
        "No compatible source was found for this media.": "无法找到此视频兼容的源。",
        "The media is encrypted and we do not have the keys to decrypt it.": "视频已加密，无法解密。",
        "Play Video": "播放视频",
        "Close": "关闭",
        "Modal Window": "弹窗",
        "This is a modal window": "这是一个弹窗",
        "This modal can be closed by pressing the Escape key or activating the close button.": "可以按ESC按键或启用关闭按钮来关闭此弹窗。",
        ", opens captions settings dialog": ", 开启标题设置弹窗",
        ", opens subtitles settings dialog": ", 开启字幕设置弹窗",
        ", opens descriptions settings dialog": ", 开启描述设置弹窗",
        ", selected": ", 选择",
        "captions settings": "字幕设定",
        "Audio Player": "音频播放器",
        "Video Player": "视频播放器",
        "Replay": "重播",
        "Progress Bar": "进度小节",
        "Volume Level": "音量",
        "subtitles settings": "字幕设定",
        "descriptions settings": "描述设定",
        "Text": "文字",
        "White": "白",
        "Black": "黑",
        "Red": "红",
        "Green": "绿",
        "Blue": "蓝",
        "Yellow": "黄",
        "Magenta": "紫红",
        "Cyan": "青",
        "Background": "背景",
        "Window": "视窗",
        "Transparent": "透明",
        "Semi-Transparent": "半透明",
        "Opaque": "不透明",
        "Font Size": "字体尺寸",
        "Text Edge Style": "字体边缘样式",
        "None": "无",
        "Raised": "浮雕",
        "Depressed": "压低",
        "Uniform": "均匀",
        "Dropshadow": "下阴影",
        "Font Family": "字体库",
        "Proportional Sans-Serif": "比例无细体",
        "Monospace Sans-Serif": "单间隔无细体",
        "Proportional Serif": "比例细体",
        "Monospace Serif": "单间隔细体",
        "Casual": "舒适",
        "Script": "手写体",
        "Small Caps": "小型大写字体",
        "Reset": "重启",
        "restore all settings to the default values": "恢复全部设定至预设值",
        "Done": "完成",
        "Caption Settings Dialog": "字幕设定视窗",
        "Beginning of dialog window. Escape will cancel and close the window.": "开始对话视窗。离开会取消及关闭视窗",
        "End of dialog window.": "结束对话视窗"
    });
    var myPlayer = '';
    var startTime = formatTime(new Date());

    function getData() {
        //判断用户是否购买课程
        ajaxToken("/jzApi/courses/selIsMyCourse", 'GET',
            {
                courseId: $("#courseId").val()
            }, function (res) {
                $("#isMyCourse").val(res.isMyCourse);
                // console.log("isMyCourse:"+res.isMyCourse);
            }
        );


    }

    function submit() {
        var is_mobi = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
        ajaxToken("/jzApi/user/selUserDetail", "GET", {}, function (r) {
            // console.log("结果：", r)
            // console.log(r.name)
            if (r.state == 1) {
                // if (r.headPortrait != "" && r.headPortrait != null && r.name != "" && r.name != null && r.sex != "" &&
                //     r.sex != null && r.idNumber != "" && r.idNumber != null && r.mobile != "" && r.mobile != null &&
                //     r.dateOfBirth != "" && r.dateOfBirth != null && r.nation != "" &&
                //     r.nation != null && r.education != "" && r.education != null && r.major != "" && r.major != null &&
                //     r.politicalAffiliation != "" && r.politicalAffiliation != null && (r.officialCapacity != "" &&
                //         r.officialCapacity != null) && r.province != "" && r.province != null && r.province != "" && r.province != null &&
                //     r.city != "" && r.city != null && r.liveAddress != "" && r.liveAddress != null && r.experience != "" &&
                //     r.experience != null){

                ajaxToken("/jzApi/courses/selCourseOrder", "POST", {
                    id: $("#courseId").val()
                }, function (res) {
                    location.href = '/couInfo/courseSurePay?orderId=' + res.orderId + '&courseId=' + $("#courseId").val() + '&type=0';
                });
                // }else {
                //     layer.alert("完善个人信息才能报名该课程");
                // }
            }
            else if (r.state == 0) {
                layer.alert("个人信息审核通过才能报名该课程");
            } else if (r.state == 3) {
                if (is_mobi) {
                    layer.confirm('完善个人信息才能报名该课程？', {
                        btn: ['确定', '取消']
                    }, function () {

                        location.href = '/cultivate/my'
                    });
                } else {
                    layer.alert("完善个人信息才能报名该课程");
                }

            }

        })


    }

</script>

</html>